package com.ican.javadoc.biz.service.user;

import org.springframework.stereotype.Service;

import com.ican.javadoc.biz.domain.user.User;
import com.ican.javadoc.biz.mapper.user.UserMapper;
import com.ican.javadoc.common.common.BusinessException;

@Service
public class UserService {

    private UserMapper userMapper;

    public void addUser(User user) throws BusinessException{
        try {
            userMapper.add(user);
        } catch (Exception e) {
            throw new BusinessException("Add user fail!", e);
        }
    }
    
    public void addUserE(User user) throws BusinessException{
        try {
            userMapper.add(user);
            throw new BusinessException("Add user fail!");
        } catch (Exception e) {
            throw new BusinessException("Add user fail!", e);
        }
    }
    
    public void setUserMapper(UserMapper userMapper) {
        this.userMapper = userMapper;
    }
}
